//index.js
//获取应用实例
const app = getApp();
const indexHttp=require('../../modules/indexHttp');
Page({
  data: {
   music:[]
  },
async onLoad(){
  var res=await indexHttp.getIndex();
  console.log(res);
  var music=[];
  var res=res.data.playlists;
  res.forEach(item => {
    var obj={};
    obj.title=item.name;
    obj.author=item.description;
    obj.pic=item.coverImgUrl;
    obj.people=item.playCount;
    music.push(obj);
  });
  this.setData({
    music
  })
},
handleDro(e){
  console.log(e.currentTarget.dataset.index)
  var index=e.currentTarget.dataset.index;
  var music=this.data.music;
  music.splice(index,1);
  this.setData({
    music
  })
}
})
